home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
EnigmA Amiga Run 1995 November
/
EnigmA AMIGA RUN 02 (1995)(G.R. Edizioni)(IT)[!][issue 1995-11][Skylink CD].iso
/
earcd
/
program
/
misc
/
mkdepend.lha
/
MkDepend-1.0
/
MkDepend.doc
< prev
next >
Wrap
Text File
|
1995-09-19
|
9KB
|
269 lines
$VER: MkDepend:doc 1.0 (18-Sep-95)
MkDepend 1.0
Copyright © 1995 by Lars Düning
All Rights Reserved.
Permission granted for non-commercial use.
Introduction
------------
Makefiles are very useful in the development of larger program systems,
as they notate the various dependencies and associated needed actions
in a machine-useable notation. Unfortunately it's the most important
dependency between C sources and their includes which have to be
maintained by hand, a most boring and errorprone task. MkDepend is one
of those programs which attempt to automate this part of development
by scanning source files for includes and repeating this step
recursively until the complete transitive closure of included files
is determined. The found dependencies are then written into an
existing makefile, keeping it up to date.
Usage
-----
MkDepend is a CLI-only program, needs at least OS 2.0 and 10 KByte stack.
Template: -F=MAKE/K,-I=INCLUDE/K/M,-X=EXCEPT/K/M,-S=SUFFIX/K/M,
-P=OBJPAT/K/M,-V=VERBOSE/S,FILES/M
mkdepend {-i|INCLUDE <includepath>[::<symbol>]}
{-x|EXCEPT <filepattern>}
{-s|SUFFIX <src_ext>{,<src_ext>}[:<obj_ext>] | :<obj_ext>}
{-p|OBJPAT <src_ext>{,<src_ext>}:<obj_pattern>
[-f|MAKE <makefile>]
[-v|VERBOSE]
{<filepattern>}
The space between the short form of the keywords and their operands
may be omitted. For example
mkdepend -IINCLUDE:
mkdepend -I INCLUDE:
mkdepend -I=INCLUDE:
are equivalent.
MkDepend is given a 'skeleton' of C source files and searches them for
included files. The Includes found are recursively searched for includes
themselves, until the complete transitive closure has been determined.
MkDepend searches the includes first in the current directory, then in
the given paths (if any), imitating the C preprocessor's behaviour.
The files are scanned for include statements of the form
#include "<filename>"
excluding those which are commented out using C-style /* */- or
C++-style //-comments. Every other content of the files is ignored.
After all includes have been found, the dependencies are written into
a makefile (creating it if necessary). The makefile is searched for
a line
# --- DO NOT MODIFY THIS LINE -- AUTO-DEPENDS FOLLOW ---
after which MkDepend adds the dependencies, overwriting old ones.
If the line is not found, it and the dependencies are added to the
file. Existing Makefiles are modified by renaming it to <origname>.bak
and then re-creating the Makefile by copying the data not to be
modified.
The found dependencies for the 'skeleton' files are written as
<skeleton> : <included file 1> <included file 2>...
Lines are limited to 80 chars, longer entries are folded into several
lines, ending each but the last line with a backslash (\).
MkDepend can be teached to know about source/object file relationships
to be used in the entries written. E,g, the entry generated for a typical
C source file would be of the form
<skeleton>.o : <skeleton>.c <include 1> <include 2> ...
Includes appear with that path in the list under which MkDepend found
them. To support multi-platform development, replacement texts may
be specified for the paths which are then used instead in the output.
Arguments
---------
<filepattern>
Any command argument not recognizable as option is considered as
specification of one of the 'skeleton' sources.
Wildcards are recognized.
Default: #?.c
Example:
mkdepend #?.c #?.cc
All files ending in ".c" or ".cc" are considered.
------
-x <filepattern>
EXCEPT <filepattern>
Files which are not part of the 'skeleton', even if they are specified
as such.
Example:
mkdepend #?.c -x test#?
All files ending in ".c", except those whose name start with "test",
are considered as sources.
------
-i <includepath>[::<symbol>]}
INCLUDE <includepath>[::<symbol>]}
Specify a directory to be searched for include files. The paths are
searched in the order given on the command line. The current
directory is always searched first.
If <symbol> is specified, the <includepath> is replaced by it in
the dependencies written to the makefile.
Example:
mkdepend -i INCLUDE:
Include files are searched in the current directory and in INCLUDE: .
mkdepend -I INCLUDE:pdlibs::$(PDLIBS)
Include files are searched in the current directory and
in INCLUDE:pdlibs. A file like "INCLUDE:pdlibs/tree.h" will be
written as "$(PDLIBS)tree.h" into the makefile.
------
-s <src_ext>{,<src_ext>}[:<obj_ext>] | :<obj_ext>}
SUFFIX <src_ext>{,<src_ext>}[:<obj_ext>] | :<obj_ext>}
Specify a name relationship between source and object files.
If a source name ends in one of the given <src_ext>s, an Makefile entry
with the object name constructed using the associated <obj_ext>.
The <obj_ext> given with no associated <src_ext> serves as default
extension used for those <src_ext> which are given without own
<obj_ext>.
Default: -s :.o -s .c
Example:
mkdepend -s :.o -s .c,.cc
Default <obj_ext> is ".obj", which is used for files with the
extension ".c" and ".cc".
------
-p <src_ext>{,<src_ext>}:<obj_pattern>
OBJPAT <src_ext>{,<src_ext>}:<obj_pattern>
Similar to SUFFIX, but allows more complicated name relations.
<obj_pattern> gives the object file name verbatim, using placeholders
for the actual filenames:
%s: the full sourcename (w/o suffix)
%p: the path part of the sourcename
%n: the base of the sourcename (w/o suffix)
%x: the character x for every x != s, p or n.
Example:
mkdepend -p .c:obj/%n.o
For every sourcefile <name>.c, an entry for obj/<name>.o is
created.
------
-f <makefile>
MAKE <makefile>
Specify the makefile to modify. If not specified, MkDepend searches
in order for "Makefile", "Makefile.mk", "DMakefile" and "SMakefile".
If none of these exists, "Makefile" is used.
------
-v
VERBOSE
Print some output during operation, namely the program name and the
file currently under examination.
Installation
------------
Copy the executable "MkDepend" into a suiting directory, profitably
into one in your search path. That's it.
Program Information
-------------------
MkDepend consists of three source files with associated includes:
reader.c,.h: Reading of source files and scanning for #include statements.
Copying and writing of makefiles.
nodes.c,.h : Management of the names and locations of the files analysed.
It is implemented as a binary search tree with an addition
linked list.
main.c : Commandline parsing and program control.
To recreate MkDepend, compile the three sources and link them.
MkDepend was written for DICE 3.01, makefiles are provided for use with
DICE own dmake (`DMakefile') and Dennis Vadura's DMake (`Makefile').
Bugs/TODO
---------
main.c is a nasty mixture of Amiga specific and generic code.
Wildcard expansion is done using DICE' expand_files(), which does not
accept the full set of wildcards implemented by AmigaDOS.
Author
------
Lars Düning, Am Wendenwehr 25, 38114 Braunschweig, Germany
duening@ibr.cs.tu-bs.de
The file reader was inspired by the input module of lcc by David Hanson
and Christopher Fraser.
Legalese
--------
MkDepend is Copyright © 1995 by Lars Düning. All Rights are reserved.
Permission granted for non-commercial use.
MkDepend may be freely distributed, provided that all copyright notices
and associated disclaimers are reproduced, and that only a reasonable
copying fee is charged. MkDepend may be included as "one program among
many" in (even commercial) software distributions.
No fee may be charged for MkDepend itself.
MkDepend may be freely modified, provided that the modifications are
made available to the public, that each changed file carries a notice
stating who changed what and when, and that the modified versions are
clearly distinguishable from the original.
Parts of MkDepend may be used in own (even commercial) programs provided
that proper credit is given.
MkDepend PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.